#if !defined(MGLIST_H__INCLUDED)
#define MGLIST_H__INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "MGConstant.h"
#include "MGPattern.h"

typedef struct tagGestureBase
{
public:
	CMGPattern pattern;
	WORD wID;
	LPTSTR pszID;
	LPTSTR pszDesc;
	BYTE bCatID;

protected:
	tagGestureBase() : wID((WORD)-1), pszID(NULL), pszDesc(NULL), bCatID(0) { }
	~tagGestureBase() { } // no virtual (not using polymorphism)
	tagGestureBase(tagGestureBase &/*rRhs*/) { }
} GESTURE_BASE;

template<class TGesture, class TImpl = CMGListImpl>
class CMGList : public TImpl
{
public:
	CMGList() : TImpl() { };

public:
	inline void Cleanup() { TImpl::Cleanup(); }

public:
	inline  int GetCount(BYTE bCatTarget = 0) { return TImpl::GetCount(bCatTarget); }

	inline  TGesture * Get(int nIndex, BYTE bCatTarget = 0) { return TImpl::Get(nIndex, bCatTarget); }

	inline  int Add(TGesture *pGesture, BYTE bCatTarget = 0) { return TImpl::Add(pGesture, bCatTarget); }

	inline  BOOL Remove(LPCTSTR pszGesture, BYTE bCatTarget = 0) { return TImpl::Remove(pszGesture, bCatTarget); }
	inline  BOOL Remove(int nIndex, BYTE bCatTarget = 0) { return TImpl::Remove(nIndex, bCatTarget); }
	
	inline  int Find(LPCTSTR pszGesture, BYTE bCatTarget = 0) { return TImpl::Find(pszGesture, bCatTarget); }
	inline  int Find(WORD wID, BYTE bCatID = 0) { return TImpl::Find(wID, bCatID); }
	
	inline  void Empty() { TImpl::Empty(); }

public:
	inline  BOOL Load(LPCTSTR pszFilePath) { return TImpl::Load(pszFilePath); }
	inline  BOOL Save(LPCTSTR pszFilePath) { return TImpl::Save(pszFilePath); }

	inline  void UpdateRegistry(BOOL bSaveAndValidate = TRUE) { TImpl::UpdateRegistry(bSaveAndValidate); }

public:
	inline  WORD GetMouseCmd(LPCTSTR pszKey, BYTE bCatTarget = 0) { return TImpl::GetMouseCmd(pszKey, bCatTarget); }
	
	inline  tstring GetCommandDesc(WORD wCommand) { return TImpl::GetCommandDesc(wCommand); }
	inline  tstring GetCommandID(WORD wCommand) { return TImpl::GetCommandID(wCommand); }
	inline  tstring GetCommandCatDesc(WORD wCommand) { return TImpl::GetCommandCatDesc(wCommand); }
	inline  BYTE GetCommandCat(WORD wCommand) { return TImpl::GetCommandCat(wCommand); }

	inline	TCHAR GetKeyMark(enum MG::KeyDef key) const { return TImpl::GetKeyMark(key); }
	inline  TCHAR GetArrowMark(enum MG::ArrowDef arrow) const { return TImpl::GetArrowMark(arrow); }
};

#endif // !defined(MGLIST_H__INCLUDED)
